package com.aaa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @Author: TT
 * @Date: 2019/3/18 9:06
 * @Version 1.0
 */
public interface T_QuestionBankDao {
    @Select("<script> select count(id) from t_document where 1=1<if test=\"id!=null and id!=0\">  and id = #{id}</if> " +
            " <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if> " +
            "limit #{start},#{pageSize}</script>")
    int getCount(Map map);
    @Select("<script> select * from t_document where 1=1<if test=\"id!=null and id!=0\">  and id = #{id}</if> " +
            " <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if> " +
            "limit #{start},#{pageSize}</script>")

    List<Map> getList(Map map);

    @Insert(" insert into t_document(id,title,time,filePath) values(null,#{title},now(),#{filePath})")
    int add(Map map);
    @Delete("delete from t_document where id=#{id}")
    int delete(Integer id);

}
